var globalConf = {};

switch (process.env.NODE_ENV) {
  case "development":
    console.log("开发环境");
    globalConf = {
      domain: {
        api: "//xf-api.muranzhidian.com",
        image: "http://xf-image.muranzhidian.com/",
        uploadUrl: "http://up-z1.qiniu.com",
        serverUrl:
          "http://xf-admin.muranzhidian.com/api/file/files/qiniu/ueditor"
      },
      needAuth: true
    };
    break;
  case "production":
    console.log("生产环境");
    globalConf = {
      domain: {
        api: "//xf-api.muranzhidian.com",
        image: "http://xf-image.muranzhidian.com/",
        uploadUrl: "http://up-z1.qiniu.com",
        serverUrl:
          "http://xf-admin.muranzhidian.com/api/file/files/qiniu/ueditor"
      },
      needAuth: true
    };
    break;
  // case "test":
  //   console.log("测试环境");
  //   globalConf = {
  //     domain: {
  //       api: "//yzjhc-api.mrshare.cn",
  //       image: "http://img.mrshare.cn/"
  //     },
  //     needAuth: true
  //   };
  //   break;
}

globalConf.appTitle = "今日安全管理后台";
globalConf.appTitleCom = "今日安全企业管理后台";
globalConf.loginSuccessRoute = { name: "dashboard" };
globalConf.menus = [
  {
    id: 3,
    menuName: "新闻管理",
    icon: "fa fa-newspaper-o",
    menuType: "Menu",
    sort: 0,
    route: '{ "name": "news"}'
  },
  {
    id: 2,
    menuName: "个人完成率统计",
    icon: "fa fa-line-chart",
    menuType: "Menu",
    sort: 1,
    route: '{ "name": "personRate"}'
  },
  {
    id: 1,
    menuName: "人员管理",
    icon: "fa fa-user",
    menuType: "Menu",
    sort: 25,
    route: '{ "name": "user"}'
  }
];

window.api = {};
window.api.domain = globalConf.domain.api;
window.api.imageDomain = globalConf.domain.image;
window.api.uploadUrl = globalConf.domain.uploadUrl;
var appConf = {};

appConf.install = function(Vue) {
  Object.defineProperty(Vue.prototype, "$appConf", {
    get: function get() {
      return globalConf;
    }
  });
};

export default appConf;
